package com.hd.entity.sys;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;


/**
 * <p>
 * 资源
 * </p>
 */
@Entity
@Table(name = "sys_resource")
public class Resource implements Serializable, Comparable<Resource> {
    private static final long serialVersionUID = 1L;
    /**
     * 主键
     */
    @Id
    private String id;

    /**
     * 资源名称
     */
    @NotBlank
    private String name;
    /**
     * 资源编码
     */
    private String code;

    /**
     * 资源路径
     */
    private String url;

    /**
     * 打开方式 ajax,iframe
     */
    @Column(name = "open_mode")
    private String openMode;

    /**
     * 资源介绍
     */
    private String description;

    /**
     * 资源图标
     */
    @JsonProperty("iconCls")
    private String icon;

    /**
     * 父级资源id
     */
    private String pid;
    /**
     * 父级资源名称
     */
    @Transient
    private String pName;

    /**
     * 排序
     */
    private Integer seq;

    /**
     * 状态
     */
    private Integer status;

    /**
     * 打开的
     */
    private Integer opened;

    /**
     * 资源类别
     */
    @Column(name = "resource_type")
    private Integer resourceType;

    /**
     * 创建时间
     */
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time")
    private Date createTime;


    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return this.url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getOpenMode() {
        return openMode;
    }

    public void setOpenMode(String openMode) {
        this.openMode = openMode;
    }

    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getIcon() {
        return this.icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getPid() {
        return this.pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public Integer getSeq() {
        return this.seq;
    }

    public void setSeq(Integer seq) {
        this.seq = seq;
    }

    public Integer getStatus() {
        return this.status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getOpened() {
        return opened;
    }

    public void setOpened(Integer opened) {
        this.opened = opened;
    }

    public Integer getResourceType() {
        return this.resourceType;
    }

    public void setResourceType(Integer resourceType) {
        this.resourceType = resourceType;
    }

    public Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getpName() {
        return pName;
    }

    public void setpName(String pName) {
        this.pName = pName;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public int compareTo(Resource o) {
        return this.seq.compareTo(o.getSeq());
    }

}